// 异步提取数据
import apiList from "../api/axios";
// import { reset } from "ansi-colors";
let poxy = "/apis";
const actions = {
  async login(context, payload) {
    //登录
    let res = await apiList.post(poxy + "/api/admin/admin_login", payload);
    return res;
  },
  async outlogin(context, payload) {
    //登出
    let res = await apiList.post(poxy + "/api/admin/admin_out_login", payload);
    return res;
  },
  async adminlistcommodity(context, payload) {
    let res = await apiList.get(poxy + "/api/admin/admin_list_commodity", {
      params: payload
    });
    return res;
  },
  async upimg(context, data) {
    // 上传图片
    let rest = await apiList.post(poxy + "/api/admin/image_upload", data);
    return rest;
  },
  // 获取可以使用的商品分类地址
  async getcomtype(context, data) {
    let res = await apiList.get(poxy + "/api/admin/admin_select_com_type", {
      params: data
    });
    return res;
  },
  // 提交商品
  async addcommodity(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/admin_add_commodity",
      data
    );
    return rest;
  },
  // 获取商品详情
  async getdetail_commodity(context, data) {
    let res = await apiList.get(poxy + "/api/admin/admin_detail_commodity", {
      params: data
    });
    return res;
  },
  // 获取分类列表
  async getcom_type_list(context, data) {
    let res = await apiList.get(poxy + "/api/admin/admin_list_com_type", {
      params: data
    });
    return res;
  },
  // 删除该分类
  async delete_class(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/admin_delete_com_type",
      data
    );
    return rest;
  },
  //添加商品分类
  async add_com_type(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/admin_add_com_type", data);
    return rest;
  },
  // 编辑商品分类
  async edit_com_type(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/admin_edit_com_type",
      data
    );
    return rest;
  },
  //启用禁用商品分类
  async disable_com_type(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/admin_edit_com_type",
      data
    );
    return rest;
  },
  // 获取所有折扣列表
  async user_list_discount(context, data) {
    let res = await apiList.get(poxy + "/api/admin/admin_list_discount", {
      params: data
    });
    return res;
  },
  // 删除折扣
  async user_delete_discount(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/admin_delete_discount",
      data
    );
    return rest;
  },
  // 获取可用的折扣列表
  async user_select_discount(context, data) {
    let res = await apiList.get(poxy + "/api/admin/admin_select_discount", {
      params: data
    });
    return res;
  },
  // 启用禁用折扣
  async user_disable_discount(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/admin_disable_discount",
      data
    );
    return rest;
  },
  // 修改折扣
  async user_edit_discount(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/admin_edit_discount",
      data
    );
    return rest;
  },
  // 添加折扣
  async user_add_discount(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/admin_add_discount", data);
    return rest;
  },
  // 添加用户类别
  async user_add_type(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/user_add_type", data);
    return rest;
  },
  // 获取用户类别(仅可用状态)
  async user_select_type(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/user_select_type", data);
    return rest;
  },
  // 用户类别列表，
  async user_list_type(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/user_list_type", data);
    return rest;
  },
  //删除会员类别
  async user_delete_type(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/user_delete_type", data);
    return rest;
  },
  // 禁用启用会员类别
  async user_disable_type(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/user_disable_type", data);
    return rest;
  },
  // 修改用户类别
  async user_edit_type(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/user_edit_type", data);
    return rest;
  },
  // 提货地址列表
  async list_pick_up(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/list_pick_up", data);
    return rest;
  },
  // 添加/ 编辑提货地址
  async add_pick_up(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/add_pick_up", data);
    return rest;
  },
  // 提货地址详情
  async detail_pick_up(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/detail_pick_up", data);
    return rest;
  },
  // 删除提货地址
  async delete_pick_up(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/delete_pick_up", data);
    return rest;
  },
  // 获取banner
  async get_banner(context, data) {
    let rest = await apiList.get(poxy + "/api/wechat/wechat_get_banner", {
      params: data
    });
    return rest;
  },
  // 删除banner
  async delete_banner(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/admin_delete_banner",
      data
    );
    return rest;
  },
  //添加banner
  async add_banner(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/admin_add_banner", data);
    return rest;
  },
  //用户充值排列表
  async recharge_log(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/admin_recharge_log", {
      params: data
    });
    return rest;
  },
  //获取优惠比例
  async get_recharge_discount(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/get_recharge_discount", data);
    return rest;
  },
  //编辑保存优惠比例
  async save_recharge_discount(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/save_recharge_discount", data);
    return rest;
  },
  //订单管理
  // / api / admin / order_list 订单列表
  async order_list(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/order_list", {
      params: data
    });
    return rest;
  },
  //订单详情
  // /
  async order_detail(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/order_detail", {
      params: data
    });
    return rest;
  },
  // 修改订单状态发货
  ///api/admin/order_ship
  async order_ship(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/order_ship", data);
    return rest;
  },
  // 用户列表
  // /api/admin/user_list
  async usertlist(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/user_list", {
      params: data
    });
    return rest;
  },
  // / api / admin / update_user_type
  //管梨园
  async edit_user(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/update_user_type", data);
    return rest;
  },
  // / api / admin / admin_addadmin
  // 添加新管理员
  async admin_addadmin(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/admin_addadmin", data);
    return rest;
  },
  // / api / admin / update_admin_password
  // 密码修改
  async update_admin_password(context, data) {
    let rest = await apiList.post(
      poxy + "/api/admin/update_admin_password",
      data
    );
    return rest;
  },
  // 管理员列表：
  async admin_list(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/admin_list", {
      params: data
    });
    return rest;
  },
  // 管理员禁用启用
  async disable_admin(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/disable_admin", data);
    return rest;
  },
  async commodity_review_list(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/commodity_review_list", {
      params: data
    });
    return rest;
  },
  // 操作权限修改
  async update_admin_permission(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/update_admin_permission", data);
    return rest;
  },

  // 编辑管理员账户名称
  async admin_edit_username(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/admin_edit_username", data);
    return rest;
  },

  // 商品评论禁用启用
  async disable_product(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/disable_product", data);
    return rest;
  },
  // 后台评论回复
  async reply_product(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/reply_product", data);
    return rest;
  },
  // 活动商品列表
  async activity_list(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/activity_com_list", {
      params: data
    });
    return rest;
  },
  // 添加活动商品
  async add_activity_com(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/add_activity_com", data);
    return rest;
  },
  // 禁用启用
  async enable_act_com(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/enable_act_com", data);
    return rest;
  },//
  // 编辑打折商品
  async edit_activity(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/edit_activity", data);
    return rest;
  },//
  //创建活动
  async create_ac(context, data) {
    let res = await apiList.post(poxy + "/api/admin/create_activity", data);
    return res;
  },
  //获取活动列表
  async activity_list_data(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/activity_list", {
      params: data
    });
    return rest;
  },
  // /api/admin/activity_class 获取活动分类
  async activity_class(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/activity_class", {
      params: data
    });
    return rest;
  },
  async doctorlist(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/doctor_review_list", {
      params: data
    });
    return rest;
  },
  // 审核医生
  async audit_doctorlist(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/review_doctor", data);
    return rest;
  },
  // 添加发票配置
  // /api/admin/tax_config
  async tax_config(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/tax_config", data);
    return rest;
  },
  //税率配置列表
  async tax_rate_list(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/tax_rate_list", {
      params: data
    });
    return rest;
  },
  // 启用禁用商品分类
  // / api / admin / enable_tax_config
  async enable_tax_config(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/enable_tax_config", data);
    return rest;
  },
  // /api/admin/enable_activity
  async enable_activity(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/enable_activity", data);
    return rest;
  },
  // url /api/admin/invoice_log
  // 开票列表
  async invoice_log(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/invoice_log", {
      params: data
    });
    return rest;
  },
  // 提醒发货列表
  // / api / admin / remind_list
  async remind_list(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/remind_list", {
      params: data
    });
    return rest;
  },
  // 生产二维码
  async cre_gift_code(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/cre_gift_code",
      data
    );
    return rest;
  },
  // /api/admin/qrcode_list 二维码列表
  async qrcode_list(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/qrcode_list",
      {
        params: data
      }
    );
    return rest;
  },
  // 改变当前状态
  async qrcode_use_status(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/qrcode_use_status",
      data
    );
    return rest;
  },
  // 生成现金券
  async create_cash(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/create_cash",
      data
    );
    return rest;
  },
  //获取现金券列表
  async get_cash(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/get_cash",
      {
        params: data
      }
    );
    return rest;
  },

  //3.启用禁用现金券
  async disable_cash(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/disable_cash",
      data
    );
    return rest;
  },

  //待发货活动商品列表
  /**
   * showdoc
   * @catalog 待发货活动商品列表
   * @title  待发货活动商品列表
   * @description 待发货活动商品列表
   * @method get
   * @url /api/admin/gifts_good_list
   * @return {"code": 0,"msg": "success","data": {"token": "9eb7aab7c5677a709aa5d09ee0b77bc7","id": 3,"info": false}
   * @remark 这里是备注信息
   * @number 99
   */
  async gifts_good_list(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/gifts_good_list",
      {
        params: data
      }
    );
    return rest;
  },
  async edit_good_status(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/edit_good_status",
      data
    );
    return rest;
  },




  /*进销存管理*/

  //商品库存列表
  async crm_inventoryList(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/crm_inventoryList",
      {
        params: data
      }
    );
    return rest;
  },
  //修改商品库存
  async crm_updateGoodsNumber(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/crm_updateGoodsNumber",
      data
    );
    return rest;
  },
  //库存修改记录
  async crm_inventoryUpdateLog(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/crm_inventoryUpdateLog",
      {
        params: data
      }
    );
    return rest;
  },
  //商品入库列表
  async crm_storageList(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/crm_storageList",
      {
        params: data
      }
    );
    return rest;
  },
  //商品入库
  async crm_goodStorage(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/crm_goodStorage",
      data
    );
    return rest;
  },
  //商品出库列表
  async crm_goodOutList(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/crm_goodOutList",
      {
        params: data
      }
    );
    return rest;
  },
  //商品出库
  async crm_addOutboundRecord(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/crm_addOutboundRecord",
      data
    );
    return rest;
  },
  //商品出库汇总
  async crm_goodOutSummary(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/crm_goodOutSummary",
      data
    );
    return rest;
  },
  //获取商品分类
  async crm_getCrmClass(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/crm_getCrmClass",
      {
        params: data
      }
    );
    return rest;
  },
  //商品管理列表
  async crm_goodManagerList(context, data) {
    let rest = await apiList.get(poxy + "/api/admin/crm_goodManagerList",
      {
        params: data
      }
    );
    return rest;
  },
   //添加编辑商品
   async crm_editGood(context, data) {
    let rest = await apiList.post(poxy + "/api/admin/crm_editGood",
      data
    );
    return rest;
  },
     //添加编辑商品
     async update_order_money(context, data) {
      let rest = await apiList.post(poxy + "/api/admin/update_order_money",
        data
      );
      return rest;
    },
};
export default actions;
